Current Location: Home> Function Categories> srand

srand

Sow the random number generator seeds
Name:srand
Category:math
Programming Language:php
One-line Description:Sow the random number generator seeds.

Definition and usage

srand() function sows the random number generator seed.

Example

In this example, we will seed the random number generator:

 <?php
srand ( mktime ( ) ) ;
echo ( rand ( ) ) ;
?>

Try it yourself

grammar

 srand ( seed )
parameter describe
seed Optional. Use seed to sow the random number generator seeds.

illustrate

Starting from PHP version 4.2.0, the seed parameter becomes optional, and when this item is empty, it will be set to any time.

Similar Functions
  • Exponential expressions pow

    pow

    Exponentialexpressio
  • Further method to sort ceil

    ceil

    Furthermethodtosort
  • Get the pi value pi

    pi

    Getthepivalue
  • Reverse cosine acos

    acos

    Reversecosine
  • Returns exp(number) - 1, and can calculate the exact result even when the value of number is close to zero. expm1

    expm1

    Returnsexp(number)-1
  • Determine whether it is infinite is_infinite

    is_infinite

    Determinewhetheritis
  • Calculate the oblique length of a straight triangle hypot

    hypot

    Calculatetheobliquel
  • Natural logarithm log

    log

    Naturallogarithm
Popular Articles